package com.taotao.job.core.localstore;

import lombok.Data;

/**
 * 恢复数据
 */
@Data
public class RecoveryMessage {

    private Integer cmd;

    private String key;

    private Long createTime = System.currentTimeMillis();

    private String json;

    /**
     * 恢复次数，默认恢复十次失败 则删除消息
     */
    private int recoveryCount = 0;
    public RecoveryMessage(String key, Integer cmd, String json) {
        this.key = key;
        this.cmd = cmd;
        this.json = json;
    }

    public RecoveryMessage(String key, Integer cmd, String json,int recoveryCount) {
        this.key = key;
        this.cmd = cmd;
        this.json = json;
        this.recoveryCount = recoveryCount;
    }


    public int incrementRecoveryCount() {
        return recoveryCount++;
    }


}